package com.iris.live.services.data.repositories;

import com.iris.live.services.data.models.Lsh保险申请表附属详细Model;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created by HangLiu on 2016/11/29.
 */
@Transactional
public interface Lsh保险申请附属表详细Repository extends JpaRepository<Lsh保险申请表附属详细Model, Integer>, JpaSpecificationExecutor<Lsh保险申请表附属详细Model> {
    @Modifying
    @Query("delete from Lsh保险申请表附属详细Model u where u.初始报价单号=?1 and u.第N年>?2 ")
    int delBy初始报价单号AndYear(String id, String year);

    @Query("select a from Lsh保险申请表附属详细Model a where a.初始报价单号=?1 and (a.批单号 is not null or a.批单日期 is not null or a.退保日期 is not null)  order by a.更新时间 desc")
    List<Lsh保险申请表附属详细Model> getInfoBycode(String code);
}
